/*
 * POSTupleComparator.java
 *
 * Created on April 25, 2007, 1:15 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package assistedpostagger;

import java.util.Comparator;

/**
 *
 * @author parezina
 */
public class POSTupleComparator implements Comparator{
    
    /** Creates a new instance of POSTupleComparator */
    public POSTupleComparator() {
    }
    
    public int compare(Object o1, Object o2) {
        
        if ((o1.getClass() != POSTuple.class) || (o2.getClass() != POSTuple.class)) {
            throw(new ClassCastException());
        }
        
        POSTuple lhs = (POSTuple) o1;
        POSTuple rhs = (POSTuple) o2;
        
        Integer lhsInt = lhs.getPosPrevalence();
        Integer rhsInt = rhs.getPosPrevalence();
        
        return rhsInt - lhsInt;
        
    }
    
}
